package com.job.ZhangMeng.Homework0709.exNply;

public class TopRoad extends Legend{
    private int hp; //生命值
    private int mp; //法力值
    private int phyForce;   //攻击力
    private int magForce;   //法术强度
    private int armor;      //护甲
    private int mr;         //魔抗

    public TopRoad(){}
    public TopRoad(int hp, int mp, int phyForce, int magForce, int armor, int mr) {
        this.hp = hp;
        this.mp = mp;
        this.phyForce = phyForce;
        this.magForce = magForce;
        this.armor = armor;
        this.mr = mr;
    }
    public void setInfo(int hp, int mp, int phyForce, int magForce, int armor, int mr)
    {
        this.hp = hp;
        this.mp = mp;
        this.phyForce = phyForce;
        this.magForce = magForce;
        this.armor = armor;
        this.mr = mr;
    }
    public void getInfo()   //显示子类TopRoad对象信息
    {
        System.out.println("生命值："+this.hp+"\t法力值："+this.mp+
                "\t攻击力："+this.phyForce+"\t法术强度："+this.magForce+
                "\t护甲："+this.armor+"\t魔抗："+this.mr);
    }
    public double attack() //重写父类方法
    {
        double harm,x,y,a,b;
        //自动类型转换,int向double靠拢
        x=this.phyForce;
        y=this.magForce;
        a=this.armor;
        b=this.mr;
        harm=x*1.6+y*0.7;
        return harm;
    }
}
